<?php
require("PHPMailer.php");

function getMailCfg(){
	$cfg = new PHPMailer();
	return $cfg;
}

function smtp_mail($sendto_email,$subject,$message){
        $mail = getMailCfg();
        $mail->IsSMTP();                // send via SMTP    
        $mail->Host = "smtp.163.com";   // SMTP servers    
        $mail->SMTPAuth = true;           // turn on SMTP authentication    
        $mail->Username = "xuqifei0426";     // SMTP username  注意：普通邮件认证不需要加 @域名    
        $mail->Password = "445465231aa"; // SMTP password    
        $mail->From = "xuqifei0426@163.com";      // 发件人邮箱    
        $mail->FromName =  "徐启飞";  // 发件人    

        $mail->CharSet = "utf-8";   // 这里指定字符集！    
        $mail->Encoding = "base64";    
        $mail->AddAddress($sendto_email,"vincent");  // 收件人邮箱和姓名    
        //$mail->AddReplyTo("xuqifei0426@163.com","163.com");    
        //$mail->WordWrap = 50; // set word wrap 换行字数    
        //$mail->AddAttachment("Public/Data/ebayListingData.xls"); // attachment 附件    
        //$mail->AddAttachment("/tmp/image.jpg", "new.jpg");    
        $mail->IsHTML(true);  // send as HTML    
        // 邮件主题    
        $mail->Subject = $subject;    
        // 邮件内容    
        $mail->Body = '   
            <html><head>   
            <meta http-equiv="Content-Language" content="zh-cn">   
            <meta http-equiv="Content-Type" content="text/html; charset=GB2312">   
            </head>   
            <body>   
            '.$message.'
            </body>   
            </html>   
        ';                                                                          
        $mail->AltBody ="text/html";    
        if(!$mail->Send())    
        {    
            return $mail->ErrorInfo;    
            exit;    
        }    
        else {
            return true;
        }    
}  


// 发送EbayListing
function sendEbayListingMessage(){

    $sendto_email='vincent.xu@cifang.hk';  //收件人
    $subject="Ebay Listing Error 数据"; //邮件主题
    // 邮件内容
    $message = "";


    return smtp_mail($sendto_email, $subject, $message );
}
sendEbayListingMessage();
?>